﻿using System;
using Pipeline.Middleware.Common;

namespace Pipeline.Middleware.Functional
{
    public class GreetingMiddleware:IMiddleware
    {
        public Func<RequestDelegate, RequestDelegate> Request()
        {
            Func<RequestDelegate, RequestDelegate> request = next =>
            {
                return context =>
                {
                    context.Request.Process("hello, request", "processed by greetingMiddleware");

                    next(context);

                    context.Response.Process("hello, request", "processed by greetingMiddleware");

                    return context;
                };

            };

            return request;
        }
    }
}